home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # Start/stop/restart the UDEV service
- #
- # This is a init script for the udevd server.
- # udev creates dynamically the files under /dev.
-
-
- PATH="/sbin:/bin"
-
- case "$1" in
- start)
- # disable hotplug helper, udevd listens to netlink
- echo "" > /proc/sys/kernel/hotplug
-
- # mount tmpfs on /dev
- if ! grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then
- # umount shm if needed
- if grep -E -q "^[^[:space:]]+ /dev/shm tmpfs" /proc/mounts; then
- umount -l /dev/shm
- fi
-
- # umount pts if needed, will remount it
- if grep -E -q "^[^[:space:]]+ /dev/pts devpts" /proc/mounts; then
- umount -n -l /dev/pts
- fi
-
- # mount tmpfs on /dev
- mount -n -o mode=0755 -t tmpfs tmpfs /dev
-
- # we are on tmpfs anyway
- mkdir /dev/shm
-
- # remount pts
- mkdir /dev/pts
- mount -n -o mode=0620,gid=5 -t devpts devpts /dev/pts
- fi
-
- # populate initial /dev with the static nodes
- cp -R -p -f /lib/udev/devices/* /dev
-
- # start udevd
- echo "Starting UDEV daemon..."
- /sbin/udevd --daemon 1>/dev/null 2>/dev/null
-
- # generate events with the sysfs trigger
- mkdir -p /dev/.udev/queue
- /sbin/udevtrigger
-
- udevd_timeout=20
- while test -d /dev/.udev/queue; do
- sleep 2
- udevd_timeout=$(($udevd_timeout - 1))
- if [ $udevd_timeout -eq 0 ]; then
- break
- fi
- done
- sleep 5
-
- ;;
- stop)
- echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
- killall udevd
- ;;
- restart)
- killall udevd
- sleep 5
- udevd --daemon
- ;;
- reload)
- udevcontrol reload_rules
- cp -R -p -f /lib/udev/devices/* /dev
- ;;
- force-reload)
- udevcontrol reload_rules
- rm -rf /dev/.udev /dev/disk
- cp -R -p -f /lib/udev/devices/* /dev
- ;;
-
- *)
- echo "Usage: $0 {start|stop|restart|reload|force-reload}"
- exit 1
- ;;
- esac
-